package com.yzy.demo.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.yzy.demo.service.ProductService;
import com.yzy.demo.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.crypto.Data;

/**
 * 商品配置
 *
 * @author 杨志远
 * @date 2025/4/5 11:06
 */
@RestController
@CrossOrigin
@Api(tags = "商品管理")
@RequestMapping("/api/product")
@SuppressWarnings("all")
public class ProductController {
    @Autowired
    private ProductService productService;

    /**
     * 测试接口
     *
     * @return
     */
    @GetMapping("/test")
    @ApiOperation("测试接口")
    public Result test() {
        return Result.ok().data("test", "测试类");
    }

    /**
     * 商品列表
     *
     * @return
     */
    @GetMapping("/productList")
    public Result prouctList() {
        return Result.ok().data("productList", productService.list());
    }
}
